

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:周次煜
 * Date: 2024-03-22
 * Time：19:57
 */

package ArrayList;
public class Test {

    public static void main(String[] args) {
        IList list=new MyArrayList();


        System.out.println("=======增加功能========");
        list.add(1);
        list.add(3);
        list.add(4);
        list.add(1,2);
        list.display();

        System.out.println("========删除功能=========");

//        list.add(-1,4);
        list.remove(2);
        list.remove(1);
        list.display();

        System.out.println("=====查找功能=======");

        int num=4;
        boolean b1=list.contains(num);
        if (b1) {
            System.out.println("含有该数据");
            System.out.println("下标为："+list.indexOf(num));
        } else {
            System.out.println("该数据不存在！");
        }


        System.out.println("========修改数据=======");
        list.set(1,9);
        list.display();


        System.out.println("=======得到数据=======");
        System.out.println(list.get(0));


        System.out.println("=======释放顺序表=======");
        list.clear();
    }
}
